package org.example.springaop.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Aspect
@Component
@Slf4j
@Order(2)
public class AspectDemo4 {

    @Before("execution(* org.example.springaop.controller.*.*(..))")
    public void before() {
        log.info("执行AspectDemo4.before方法...");
    }

    @After("execution(* org.example.springaop.controller.*.*(..))")
    public void after() {
        log.info("执行AspectDemo4.after方法...");
    }

//    @Around("execution(* org.example.springaop.controller.*.*(..))")
//    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
//        log.info("执行AspectDemo.around方法...");
//        Object result =  joinPoint.proceed();
//        log.info("执行AspectDemo.around方法...");
//        return result;
//    }
//
//    @AfterThrowing("execution(* org.example.springaop.controller.*.*(..))")
//    public void afterThrowing() {
//        log.info("执行AspectDemo.afterThrowing方法...");
//    }
//
//    @AfterThrowing("execution(* org.example.springaop.controller.*.*(..))")
//    public void afterReturning() {
//        log.info("执行AspectDemo.afterReturning方法...");
//    }
}
